package com.example.travelservlet.search.repository;

import com.example.travelservlet.entity.HotSearch;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;

/**
 * @author kiki
 * @dtae 2023/4/23 11:09
 */
public interface HotSearchRepository extends JpaRepository<HotSearch, Integer> {
    @Transactional
    @Modifying(clearAutomatically = true)
    @Query(value = "update hot_search set click_num=?2 where hot_search_id=?1", nativeQuery = true)
    Integer updateHotSearch(Integer id, Integer clickNum);
}
